<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!--引用CW标签  -->
<%@ taglib uri="/WEB-INF/taglib/cw" prefix="CW" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath%>css/en/edit.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=basePath%>js/commons/common_edit.js"></script>
</head>
<body>
<jsp:include page="../../common/loadingPage.jsp" />
<form action="withdraw/insert.action" name="actionForm" id="actionForm" method="post">
	<div class="pageheader">
		<!-- 操作按钮 -->
		<div class="pageheadercontent">
			<div class="toolbar">
				<div class="toolbarright">
					<input class="okbtn" name="_submit" type="button" value="OK" onclick="__submit()">
				</div>
			</div>
		</div>
	</div>
	<!-- 编辑 -->
	<div class="writetblbox">
		<table class="writetbl">
			<tr>
				<td colspan="4">
					可提现 <s:property value="withdraw.w_score" /> 积分，每积分可提现1人民币，提交后不可修改
				</td>
			</tr>
			<tr>
				<th style="width: 25%">提现银行：</th>
				<td style="width: 25%">
					<s:property value="withdraw.bank_name" />
				</td>
				<th style="width: 25%">提现用户名：</th>
				<td style="width: 25%">
					<s:property value="withdraw.bank_user" />
				</td>
			</tr>
			<tr>
				<th>提现账号：</th>
				<td colspan="3">
					<s:property value="withdraw.bank_account" />
				</td>
			</tr>
			<tr>
				<th>提现积分：</th>
				<td>
					<input type="text" name="withdraw.w_score" id="wScore" value="<s:property value="withdraw.w_score" />" onkeyup="getAmount()"/>
					<input type="hidden" id="maxScore" value="<s:property value="withdraw.w_score" />"/>
				</td>
				<th>可得金额（元）：</th>
				<td>
					<input type="text" name="withdraw.amount" id="amount" value="<s:property value="withdraw.amount" />" readonly="readonly"/>
				</td>
			</tr>
		</table>
	</div>
</form>
<span class="_height"></span>
<script type="text/javascript">
	$(document).ready(function() {
		$('#actionForm').validate({
			rules : {
		        "withdraw.w_score" : {
					required : true,
					number : true,
					maxlength : 14
				}
			}
		});
	});
	function getAmount(){
		if(checkNumber($("#wScore").val())){
			var wScore=Number($("#wScore").val());
			var maxScore=Number($("#maxScore").val());
			if(wScore>maxScore){
				art.dialog.tips('超出最大提现额度！');
				$("#amount").val("0");
			}else{
				$("#amount").val(wScore);
			}
		}else{
			$("#amount").val("0");
		}
	}
	function __submit(){
	 	if($("#actionForm").valid()){
			getAmount();
			if($("#amount").val()!=0){
				$("#loadingdiv").show();
				document.actionForm.submit();
			}
		}
	}
	//验证字符串是否是数字
	function checkNumber(theObj) {
	  var reg = /^[0-9]+.?[0-9]*$/;
	  if (reg.test(theObj)) {
	    return true;
	  }
	  return false;
	}
</script>
</body>
</html>
